import 'dart:async';

import 'package:flutter/material.dart';

void main() => runApp(new ProgressIndicator());

class ProgressIndicator extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new ProgressIndicatorWidget(),
    );
  }
}

class ProgressIndicatorWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new ProgressIndicatorState();
  }
}

class ProgressIndicatorState extends State<ProgressIndicatorWidget> {
  Timer timer;
  var progress = 0.1;

  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    final width = size.width;
    final height = size.height;
    return new Scaffold(
        body: SafeArea(
            child: Center(
                child: Padding(
      padding: EdgeInsets.only(top: 20),
      child: Column(
        children: <Widget>[
          SizedBox(
            width: width / 2,
            height: 5,
            child: LinearProgressIndicator(
              valueColor: AlwaysStoppedAnimation(Colors.blue),
              backgroundColor: Colors.grey,
            ),
          ),
          Padding(
            padding: EdgeInsets.only(top: 10),
          ),
          SizedBox(
            width: 100,
            height: 100,
            child: CircularProgressIndicator(
              valueColor: AlwaysStoppedAnimation(Colors.red),
              backgroundColor: Colors.grey,
              strokeWidth: 5.0,
              value: progress,
            ),
          ),
        ],
      ),
    ))));
  }

  @override
  void initState() {
    super.initState();
    initTimer();
  }

  void initTimer() {
    if (timer == null) {
      timer = Timer.periodic(Duration(seconds: 1), (timer) {
        setState(() {
          progress += 0.1;
          if (progress > 1) {
            progress = 0.1;
          }
        });
      });
    }
  }
}
